package com.liuwa.openapi.controller;

import com.liuwa.common.utils.bean.BeanUtils;
import com.liuwa.framework.web.service.TokenService;
import com.liuwa.knowledge.domain.User;
import com.liuwa.openapi.common.BaseController;
import com.liuwa.openapi.vo.UserVo;
import com.liuwa.system.service.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户
 * @author Liuwa
 *
 * 2023年10月29日
 */
@RestController
@Api(value = "用户", tags={"用户"})
@RequestMapping("/openapi/users")
public class OpenapiUserController extends BaseController {

    @Autowired
    private SysUserService userService;

    @Autowired
    private TokenService tokenService;


    /**
     * 获取用户信息
     * @return
     */
    @ApiOperation("用户信息")
    @GetMapping("/self")
    public UserVo self() {
        User user = getLoginUser();
        return BeanUtils.convert(user, UserVo.class);
    }




}
